package com.tanhua.server.controller;

import com.tanhua.model.mongo.Demo;
import com.tanhua.server.service.TestSoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class TestSoulController {
    @Autowired
    TestSoulService testSoulService;

    //问卷列表
    @GetMapping
    public ResponseEntity gettestSoul(){
       List<Demo> demos=testSoulService.gettestSoul();
        System.out.println(demos);
       return ResponseEntity.ok(demos);
    }

    //提交问卷
    @PostMapping
    public ResponseEntity submitDemo(@RequestBody Map answers){
        System.out.println(answers);
        return ResponseEntity.ok("61d96e7077110000130041a2");
    }

    //查看测试结果
    @GetMapping("/report/{id}")
    public ResponseEntity testreport(@PathVariable String id){
     return    testSoulService.testreport(id);

    }
}
